<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>哈哈哈</button>
    <button>呵呵呵</button>
    <button>乐乐了</button>

    <div class="conment">

    </div>
</body>
</html>
<script>
    let arr1 = [1231235,26,34,57,47,231,42,6,4,85,679,768,43,214,43,65,9,786,10]
    let btn = document.querySelectorAll('button')
    let conment = document.querySelector('.conment')

    let arr = [ 
        {type : '/home' , fcn : fn},
        {type : '/banner' , fcn : fn},
        {type : '/bottom' , fcn : fn}
     ]

    btn.forEach((item , index) => {
        item.onclick = ()=>{
            history.pushState({} , '' , arr[index].type)
            arr[index].fcn()
        }
    })

    function fn () {
        conment.innerHTML = ''
        for(let i = 0 ; i < 10 ; i++){
            conment.innerHTML += arr1[Math.round(Math.random() * (arr1.length - 1))] +`<br>`
        }
    }

</script>